<?php
uses('sanitize');

class AppController extends Controller
{
    var $Sanitize;
	var $components  = array('othAuth','Pagination','RequestHandler');	
	var $helpers = array('Html', 'OthAuth','Pagination','Ajax','Javascript','Error','Furmi');
	
	// *********************************************
	var $othAuthRestrictions = array('admin');#   *
	// *********************************************

    function __construct()
    {
		parent::__construct();
		$this->Sanitize = &new Sanitize;
		
//		echo $this->name;
//		var_dump($this->action);
//		print_r($this->params);
//		/echo $this->params['controller'];
		
    }
	
    function ajaxValidate()
	{
		$this->autoRender=false;
		$model = $this->modelNames;
		
		echo current($this->$model[0]->invalidFields($this->data));
		//var_dump($this->data);
	}
	
    function ajaxValidateFake()
	{
		$this->autoRender=false;
		echo '';
	}
    
	function checkForErrors()
	{			
 
	}
	
	
	function beforeFilter()
	{
		//if(isset($this->params['admin']))
		//{
		//	$this->layout = 'admin';
		//}

		//$this->set('right',$this->params);

		$auth_conf = array(
                    'mode'  => 'oth',
                    'login_page'  => '/loguj',
                    'logout_page' => '/wyloguj',
                    'access_page' => '/profil',
                    'hashkey'     => 'MySEcEeTHaSHKeYz',
                    'noaccess_page' => '/users/noaccess',
                    'strict_gid_check' => false);

                    $this->othAuth->controller = &$this;
                    $this->othAuth->init($auth_conf);
                    $this->othAuth->check();

			//$this->layout = 'first';
	}		
}
?>